/**
 * 
 */
package console;

import java.io.ByteArrayOutputStream;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.zip.GZIPOutputStream;
import java.io.*;
import java.net.*;
/**
 * @author jdd01
 *
 */
public class show {



	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

        String subscribeRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sdql><SubscribeRequest subscriptionSpecificationName=\"JiangDuoDuo\"/></sdql>";

        ByteArrayOutputStream bos1 = new ByteArrayOutputStream();

        GZIPOutputStream gos = new GZIPOutputStream(bos1);
        gos.write(subscribeRequest.getBytes("UTF-8"));
        gos.close();


        SocketAddress address = new InetSocketAddress("sept.betbrain.com", 7000);
        Socket soknet2 = new Socket();
        //java.net.//
        soknet2.connect(address, 15000);

        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;

        try {
            bis = new BufferedInputStream(soknet2.getInputStream());
            bos = new BufferedOutputStream(soknet2.getOutputStream());

            byte[] gzippedContent = bos1.toByteArray();
bos.write(Integer.toString(gzippedContent.length).getBytes("UTF-8"));
            bos.write(0);
            bos.write(gzippedContent);
            bos.flush();

            while (bis.read() > 0) {
                System.out.println("Read something");
            }

        } catch (Exception e) {
            System.out.println("Hello");
        }
    }



}
